package com.zhaopin.file;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.util.Map;

/**
 * @author Administrator
 * @create 2020-02-12 17:49
 */
public class JsonToUrl {

    public static void main(String[] args) {

        String str = "{\n" +
                " \"CompanyId\": 39493793,\n" +
                " \"start\": 0,\n" +
                " \"rows\": 2,\n" +
                " \"S_DISCLOSURE_LEVEL\": 2,\n" +
                " \"S_CV_ACTIVE_TIME_LAST\": \"1624754705,1627382289\",\n" +
                " \"eventScenario\": \"talents\",\n" +
                " \"UserId\": 1049895014,\n" +
                " \"client\": \"homepage\",\n" +
                " \"DepartmentId\": 39493793,\n" +
                " \"jobNumber\": \"CC875646790J40193517614\",\n" +
                " \"testplatform\": 1,\n" +
                " \"flDebug\": \"false\",\n" +
                " \"S_CV_JOB_LEVEL_ALL\":\"19000200100000\",\n" +
                " \"S_COMPANY_NAME_ALL\":\"格立 小米\",\n" +
                " \"S_WORK_YEARS\": \"201603,201903\",\n" +
                " \"S_KEYWORD_COMPLETE_NEW\":\"阿里巴巴\",\n" +
                " \"S_SCHOOL_NAME_ALL\":\"清华 北大\",\n" +
                " \"S_CV_RPO_ACTIVITY_REFRESH_DATE\":\"\",\n" +
                " \"S_CV_RPO_ACTIVITY_USER_UNCONFIRM_REFRESH_DATE\":\"1621267200,1627611888\",\n" +
                " \"S_CV_RPO_ACTIVITY_USER_CONFIRM_REFRESH_DATE\":\"1621267200,1627611888\",\n" +
                " \"S_ONLY_USE_RPO\":\"0\"\n" +
                "}";
        JSONObject jsonObject = JSON.parseObject(str);
        StringBuilder stringBuilder = new StringBuilder();
        for (Map.Entry<String, Object> stringObjectEntry : jsonObject.entrySet()) {
            String key = stringObjectEntry.getKey();
            Object value = stringObjectEntry.getValue();
            stringBuilder.append(key+ "=" + value+"&");
        }
        System.out.println(stringBuilder.toString());
    }
}
